The present invention relates to a process for preparing an aliphatic or semiaromatic polyamide, in which a polyamide prepolymer is subjected to a solid state polymerization.